<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简单登录注册页面</title>
    <link rel="stylesheet" href="./登录.css">
</head>

<body>
    <script src="./登录.js"></script>
    <div class="box">
        <h2>Login</h2>
        <div class="input-box">
            <label>账号</label>
            <input type="text" class="user_master">
            <span>账号输入错误</span>
        </div>
        <div class="input-box">
            <label>密码</label>
            <input type="password" class="user_master_password">
            <span>密码输入错误</span>
        </div>
        <div class="btn-box">
            <div>
                <button onclick="fun()">登录</button>
                <button onclick="fn()">注册</button>
            </div>
        </div>
    </div>
    <!-- //JQuery引入 -->
    <script src="https://code.jquery.com/jquery-3.7.1.js"></script>
    <script>
        //取数据
        var user_name = localStorage.getItem("name")
        var user_password = localStorage.getItem("password")
    </script>
    <script>
        //条件判断账号
        $('.user_master').on("blur", () => {
            if ($(".user_master").val() == user_name) {
                $(".user_master").next().hide()
            } else {
                $(".user_master").next().show()
            }
        })
    </script>
    <script>
        //条件判断
        $(".user_master_password").on("blur", () => {
            if ($(".user_master_password").val() == user_password) {
                $(".user_master_password").next().hide()
            } else {
                $(".user_master_password").next().show()
            }
        })
    </script>
    <script>
        //最后判断
        function fun() {
            if ($(".user_master").val() != user_name) {
                alert("用户名输入错误")
            } else if ($(".user_master_password").val() != user_password) {
                alert("密码输入错误")
            } else {
                location.assign("/首页/首页.html")
            }
        }
    </script>
    <script>
        //注册跳转
        function fn() {
            location.assign("/注册/注册.html")
        }
    </script>
</body>

</html>